package com.hiwan.system.pojo;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class HiwanFile {
	private String fileName;
	private long fileSize;
	private File file;

	public HiwanFile(File file) {
		this.file = file;
		this.fileName = file.getName();
		this.fileSize = file.length();
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public long getFileSize() {
		return fileSize;
	}

	public void setFileSize(long fileSize) {
		this.fileSize = fileSize;
	}

	public boolean exists() {
		return file.exists();
	}

	public InputStream getFileInputStream() throws Exception {
		return new FileInputStream(file);
	}
	

	public File getFile() {
		return file;
	}

	public boolean delete() {
		return file.delete();
	}

	public String toString() {
		return "HiwanFile[" + fileName + "," + fileSize + "," + file.exists() + "," + file.getAbsolutePath() + "]";
	}
}
